package com.panda.game.xls.action;

import com.panda.game.xls.constant.ScreenConstant;
import com.panda.game.xls.screen.TabPage2;
import com.panda.game.xls.screen.TabPage3;

import java.awt.event.ActionEvent;

public class AddRowAction extends MyAbstractAction {

    public AddRowAction() {

    }

    public AddRowAction(String type) {
        super.setType(type);
    }

    @Override
    protected void beforeAction(ActionEvent e) {

    }

    @Override
    protected void doAction(ActionEvent e) {
        String type = super.getType();
        if (type == null) {
            return;
        }
        if (ScreenConstant.ADD_TYPE_SHEETTYPEDATA.equals(type)) {
            TabPage2.tableModel.addRow(new Object[]{"", "", ""});
        }
        if (ScreenConstant.ADD_TYPE_PERSON.equals(type)) {
            TabPage3.tableModel.addRow(new Object[]{"", ""});
        }
    }

    @Override
    protected void afterAction(ActionEvent e) {

    }
}
